using DataTestFramework.NHibernate.Models;

using FluentNHibernate.Mapping;

using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;


namespace DataTestFramework.NHibernate.Mappers
{
    public class NhCustomerMapping : ClassMap<NhCustomer>
    {
        public NhCustomerMapping()
        {
            Table("Customers");
            Id(m => m.CustomerId).GeneratedBy.Identity();
            Map(m => m.CustomerName).Length(50).Not.Nullable();
            Map(m => m.ContactName).Length(50).Not.Nullable();
            Map(m => m.Address).Length(100).Not.Nullable();
            Map(m => m.PostalCode).Length(10).Not.Nullable();
            Map(m => m.Tel).Length(50).Not.Nullable();
            HasMany(m => m.Orders).KeyColumn("CustomerId").LazyLoad();
        }
    }
}
